home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / rsxwdk2s.zip / RSXWDK / LIBSRC / DOS / DOS56.C < prev    next >
C/C++ Source or Header  |  1994-12-17  |  484b  |  28 lines

  1. #include <errno.h>
  2. #include <sys/doscalls.h>
  3.  
  4.  
  5. /*
  6. ** AH = 0x56
  7. ** DS:DX name (64 bytes)
  8. ** ES:DI name (64 bytes)
  9. */
  10. int dos_rename(const char *oldname, const char *newname)
  11. {
  12.     struct REGPACK r;
  13.     struct SEGPACK sr;
  14.  
  15.     r.eax = 0x5600;
  16.     SET_SEG_OFF(oldname, sr.ds, r.edx);
  17.     SET_SEG_OFF(newname, sr.es, r.edi);
  18.  
  19.     _intxr(0x21, &r, &sr);
  20.  
  21.     if (r.eflags & 1) {
  22.     _sys_doserror2errno( r.eax & 0xFFFF);
  23.     return (-1);
  24.     }
  25.     else
  26.     return (0);
  27. }
  28.